<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>判断是否是闰年</title>
    <script>
        function year(n) {
            if ((n % 4 == 0 && n % 100 != 0) || n % 400 == 0) {
                return '输入的年份为闰年'
            } else {
                return '输入的年份为平年'
            }
        }
        var n = prompt('请输入一个年份')
        if (!isNaN(n)) {
            alert(year(n))
        } else {
            alert('请输入正确的年份')
        }
    </script>
</head>

<body>

</body>

</html>